import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt

# 假设数据
V_a = np.array([0, 0.5, 1.0, 0, 0.5, 1.0])  # 纤维A掺量
V_b = np.array([0, 0, 0, 1.0, 1.5, 2.0])  # 纤维B掺量
F_c = np.array([30, 35, 40, 38, 42, 43])  # 混凝土强度

# 定义模型函数
def model(V, F_c0, a1, a2, b1, b2, c):
    V_a, V_b = V
    return F_c0 + a1*V_a + a2*V_b - b1*V_a**2 - b2*V_b**2 + c*V_a*V_b

# 拟合模型
params, covariance = curve_fit(model, (V_a, V_b), F_c)

# 输出拟合参数
print("Fitted parameters:", params)